@echo off
echo.
echo delete all old network drives
echo.
net use o: /delete /yes
net use h: /delete /yes

set /p username="Please write your ZIH Loginname: "

set "psCommand=powershell -Command "$pword = read-host 'Enter Password' -AsSecureString ; ^
    $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
        [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
for /f "usebackq delims=" %%p in (`%psCommand%`) do set password=%%p

echo.
echo the network-shares for all Users on the CFAED vFiler are connected, please wait...
echo.
net use o: \\cfaedoffice.cfaed.tu-dresden.de\cfaed %password% /User:dom\%username% /Persistent:no
net use h: \\vs-home.zih.tu-dresden.de\%username% %password% /User:dom\%username% /Persistent:no

Pause

